package com.heima.user.controller.v1;

import com.heima.common.constants.UserConstants;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.AuthDto;
import com.heima.user.service.ApUserAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName:ApUserAuthController
 * Package:com.heima.user.controller.v1
 * Description:
 *
 * @Author: zongyu
 * @Create: 2024/3/13 - 17:27
 */
@RestController
@RequestMapping("/api/v1/auth")
public class ApUserAuthController {
    @Autowired
    private ApUserAuthService apUserAuthService;
    @PostMapping("/list")
    public ResponseResult list(@RequestBody AuthDto dto){
        return apUserAuthService.list(dto);
    }
    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDto dto){
        return apUserAuthService.updateStatus(dto, UserConstants.FAIL_AUTH);
    }
    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody AuthDto dto){
        return apUserAuthService.updateStatus(dto, UserConstants.PASS_AUTH);
    }
}
